﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.league" Title=" " StylesheetTheme="SkinFile" Codebehind="league.aspx.cs" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, league_PageNameLabel %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
    <asp:HiddenField ID="LeagueIdHiddenFirld" runat="server" />
    <asp:HiddenField ID="CountryIdHiddenField" runat="server" />
    <div class="basic_element">
    <asp:Panel ID="Panel1" runat="server" Visible='<%# this.ErrorLabel.Text != "" %>'>
        <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>
    </asp:Panel>    
    <div class="red_title_no_padding">
    <div class="grey_title_inside_red floater" >
        <asp:Label ID="LeagueNameLabel" runat="server" CssClass="team_name_white" /> 
        <asp:Label ID="LeagueLevelLabel" runat="server" CssClass="team_id_white"/>           
    </div>
    <div class="grey_title_triangle floater"></div>
    <div class="floater padding_top2">
        <asp:ImageButton ID="CountryFlagImage" runat="server" />
        <asp:ImageButton ID="ForumImageButton" runat="server" ImageUrl="~/Images/Icons/forum.png" ToolTip="<%$ Resources:Resource, league_ForumImageButton %>"/>   
        <asp:ImageButton ID="BookmarkButton" runat="server" Visible="false" OnClick="BookmarkButton_Click" 
        ImageUrl="~/Images/bookmarks.png" ToolTip="<%$ Resources:Resource, league_BookmarkButtonToolTip %>"/> 
    </div>
    </div>
    <div class="padding5">
        <asp:UpdatePanel ID="LeaguesSelectionPanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
            <tr>
            <td>
                <asp:Label ID="QuickLeaguesNavigationLable" runat="server" Text="<%$ Resources:Resource, league_QuickLeaguesNavigation %>" SkinID="InfoLabel"></asp:Label>
                <asp:DropDownList ID="LevelsDDL" runat="server" DataSourceID="LeagueLevelsDataSource" DataTextField="LevelText" DataValueField="LevelNum"
                 AutoPostBack="true" OnSelectedIndexChanged="LevelSelected">
                </asp:DropDownList>
                <asp:DropDownList ID="NumberDropDownList" runat="server" OnSelectedIndexChanged="GoToLeague" AutoPostBack="true" Visible="false">
        
                </asp:DropDownList>
    
                <asp:SqlDataSource ID="LeagueLevelsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="Nivdal_GetLeagueLevelsAll" SelectCommandType="StoredProcedure">
                </asp:SqlDataSource> 
            </td>
            <td>
                <asp:UpdateProgress AssociatedUpdatePanelID="LeaguesSelectionPanel" ID="LeaguesSelectionPanelProgress" runat="server">
                    <ProgressTemplate>
                        <div class="ajaxloader">
                            <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
                        </div>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </td>
            </tr>
            </table>
        
        </ContentTemplate>
        </asp:UpdatePanel>
        <asp:HyperLink ID="BonusPromotionHyperlink" runat="server" SkinID="GreenTitleHyperLink" 
            Text="<%$ Resources:Resource, League_BonusPromotionLinkText %>"></asp:HyperLink>
        <br />
        <asp:GridView ID="GridView4" runat="server" DataSourceID="SqlDataSource2" SkinID="Professional"
            AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField ItemStyle-Width="5%">
                    <ItemTemplate>
                        <asp:Label ID="Label18" runat="server" Text='<%# Eval("N")%>' SkinID="GridLabel"> </asp:Label>                    
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <ItemTemplate>
                        <asp:Image ID="GreenArrowImage" runat="server" ImageUrl="~/Images/Icons/arrowup.png" Visible='<%# Eval("GreenVisible") %>' />
                        <asp:Image ID="RedArrowImage" runat="server" ImageUrl="~/Images/Icons/arrowdown.png" Visible='<%# Eval("RedVisible") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="35%">
                    <HeaderTemplate>
                        <asp:Label ID="TeamNameLabel" ToolTip="<%$ Resources:Resource, league_TeamNameLabelToolTip %>" runat="server" Text="<%$ Resources:Resource, Global_TeamName %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("Team Name") %>' SkinID="BlackHyperLinkSkin"
                         NavigateUrl='<%# Eval("TeamId ", "TeamHomePage.aspx?TeamId={0}") %>'></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <HeaderTemplate>
                        <asp:Label ID="GamesLabel" ToolTip="<%$ Resources:Resource, Global_Games %>" runat="server" Text="<%$ Resources:Resource, Global_GamesHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Games")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <HeaderTemplate>
                        <asp:Label ID="PointLabel" ToolTip="<%$ Resources:Resource, Global_Points %>" runat="server" Text="<%$ Resources:Resource, league_PointLabel %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("P")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="11%">
                    <HeaderTemplate>
                        <asp:Label ID="GoalsLabel" ToolTip="<%$ Resources:Resource, Global_Goals %>" runat="server" Text="<%$ Resources:Resource, Global_GoalsHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Goals")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <HeaderTemplate>
                        <asp:Label ID="WinsLabel" ToolTip="<%$ Resources:Resource, league_WinsLabelTooltip %>" runat="server" Text="<%$ Resources:Resource, league_WinsLabel %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("W")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <HeaderTemplate>
                        <asp:Label ID="DrawsLabel" ToolTip="<%$ Resources:Resource, Global_Draws %>" runat="server" Text="<%$ Resources:Resource, Global_DrawsHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("D")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%">
                    <HeaderTemplate>
                        <asp:Label ID="LossesLabel" ToolTip="<%$ Resources:Resource, Global_Losses %>" runat="server" Text="<%$ Resources:Resource, Global_LossesHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("L")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="WinsAtHomeLabel" ToolTip="<%$ Resources:Resource, league_WinsAtHomeLabelToolTip %>" runat="server" Text="<%$ Resources:Resource, league_WinsAtHomeLabel %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("WH")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="DrawsAtHomeLabel" ToolTip="<%$ Resources:Resource, Global_DrawsAtHome %>" runat="server" Text="<%$ Resources:Resource, Global_DrawsHomeHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("DH")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="LossesAtHomeLabel" ToolTip="<%$ Resources:Resource, Global_LossesAtHome %>" runat="server" Text="<%$ Resources:Resource, Global_LossesHomeHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("LH")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="WinsAwayLabel" ToolTip="<%$ Resources:Resource, league_WinsAwayLabelToolTip %>" runat="server" Text="<%$ Resources:Resource, league_WinsAwayLabel %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("WA")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="DrawsAwayLabel" ToolTip="<%$ Resources:Resource, Global_DrawsAway %>" runat="server" Text="<%$ Resources:Resource, Global_DrawsAwayHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("DA")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="4%">
                    <HeaderTemplate>
                        <asp:Label ID="lossesAwayLabel" ToolTip="<%$ Resources:Resource, Global_LossesAway %>" runat="server" Text="<%$ Resources:Resource, Global_LossesAwayHeader %>"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("LA")%>' SkinID="GridLabel"> </asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <br />
        <asp:Hyperlink ID="FixturesPageLinkButton" runat="server" SkinID="GreenTitleHyperLink" 
        Text="<%$ Resources:Resource, league_FixturesPageLinkButton %>"></asp:Hyperlink>
        &nbsp;
        <asp:Hyperlink ID="OldLeaguLinkButton" runat="server" SkinID="GreenTitleHyperLink" 
        Text="<%$ Resources:Resource, league_OldLeaguLinkButton %>"></asp:Hyperlink>
    </div>
    </div>
    <div class="tbl">
    <div class="tblr">
    <div class="tblctop marginright5">
        <div class="basic_element" style="width:96%;">
        <div class="red_title">
            <asp:Label ID="NextRoundLabel" runat="server" Text="<%$ Resources:Resource, league_NextRoundLabel %>" CssClass="white_title"></asp:Label>
            <asp:Label ID="NextRoundMatchesDateLabel" runat="server" CssClass="white_title"></asp:Label>
            <asp:ImageButton ID="AddAllRoundToLiveButton" runat="server" ImageUrl="~/Images/Icons/LiveDetails.png" 
                OnClick="AddAllRoundToLive" ToolTip="<%$ Resources:Resource, league_AddAllRoundToLiveToolTip %>" />    
        </div>
        <div class="padding5">
            <asp:GridView ID="GridView2" runat="server" SkinID="Professional" DataSourceID="SqlDataSource6" AutoGenerateColumns="false"
                OnRowCommand="NextRoundMatchesCommand">
            <Columns>
                <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Match %>">
                    <ItemTemplate>
                        <asp:Hyperlink ID="LinkButton1" runat="server" Text='<%# Eval("title") %>' SkinID="BlackHyperLinkSkin"
                        NavigateUrl='<%# Eval("Id", "MatchPage.aspx?MatchId={0}") %>'></asp:Hyperlink>                        
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:ImageButton ID="AddToliveImageButton" runat="server" CommandName="AddToLive" CommandArgument='<%# Eval("Id") %>'
                            ToolTip="<%$ Resources:Resource, Live_AddMatchToLiveText %>" ImageUrl="~/Images/Icons/LiveDetails.png" Visible='<%# IsAllowedLive(Eval("CanAddToLive")) %>' />
                        <asp:ImageButton ID="BookmarkMatchButton" runat="server" CommandArgument='<%# Eval("Id") %>' ImageUrl="~/Images/bookmarks.png"
                            CommandName="Bookmark" ToolTip="<%$ Resources:Resource, MatchPage_BookmarkLinkButtonToolTip %>" Visible='<%# IsPremium() %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <asp:Label ID="NoMatchesWereScheduledLabel" runat="server" Text="<%$ Resources:Resource, league_NoMatchesWereScheduledLabel %>" SkinID="InfoLabel"></asp:Label>
            </EmptyDataTemplate>
            </asp:GridView>
        </div>
        </div>
        <div class="basic_element"  style="width:96%;">
        <div class="red_title">
            <asp:Label ID="LastRoundLabel" runat="server" Text="<%$ Resources:Resource, league_LastRoundLabel %>" CssClass="white_title"></asp:Label>
        </div>
        <div class="padding5">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" SkinID="Professional"
                DataSourceID="SqlDataSource5">
                <Columns>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Match %>">
                        <ItemTemplate>
                            <asp:Hyperlink ID="LinkButton1" runat="server" Text='<%# Eval("Title") %>' 
                                NavigateUrl='<%# Eval("Id", "MatchPage.aspx?MatchId={0}") %>' SkinID="BlackHyperLinkSkin"></asp:Hyperlink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Result %>">
                        <ItemTemplate>
                            <asp:Label ID="ResultLabel" runat="server" Text='<%# Eval("Result") %>' SkinID="GridLabel"/>
                            </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <asp:Label ID="NoMatchesLabel" runat="server" Text="<%$ Resources:Resource, league_NoMatchesLabel %>" SkinID="InfoLabel"></asp:Label>
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
        </div>
            
    </div>
    <div class="tblctop marginleft5">
        <asp:Panel ID="ScorersPanel" runat="server">                
            <div class="basic_element" style="width:96%;">
            <div class="red_title">
                <asp:Label ID="TopScorersTitleLabel" runat="server" CssClass="white_title"
                    Text="<%$ Resources:Resource, league_TopScorersTitleLabelText %>"></asp:Label>
            </div>
            <div class="padding5">
                <asp:GridView ID="ScorersGridView" runat="server" AutoGenerateColumns="false" SkinID="Professional"
                    DataSourceID="TopScorersDataSourse" AllowPaging="false">
                    <Columns>
                        <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Player %>">
                            <ItemTemplate>
                                <asp:HyperLink ID="PlayerHyperlink" runat="server" Text='<%# Eval("PlayerName") %>'
                                    NavigateUrl='<%# "~/Player.aspx?Id=" + Eval("PlayerId") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Team %>">
                            <ItemTemplate>
                                <asp:HyperLink ID="TeamHyperlink" runat="server" Text='<%# Eval("TeamName") %>'
                                    NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("TeamId") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>                        
                        <asp:TemplateField  HeaderText="<%$ Resources:Resource, Global_Goals %>">
                            <ItemTemplate>
                                <asp:Label ID="NumGoalsLabel" runat="server" Text='<%# Eval("NumLeagueGoals") %>' SkinID="GridLabel"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>     
                    </Columns>
                </asp:GridView>
            </div>
            </div>
        </asp:Panel>
        <asp:SqlDataSource ID="TopScorersDataSourse" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_ShowLeagueTopScorers" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>     
    </div>
    </div>
    </div>        

                


               

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ShowLeagueDetails" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ShowLeagueTable" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ShowLeaguePreviousRoundMatches" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource6" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ShowLeagueNextRoundMatches" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
</asp:Content>
